package com.mooc.lib_network;

import java.util.Map;

import okhttp3.FormBody;

/**
 * @ClassName: PostRequest$
 * @Description: java类作用描述
 * @Author: 魏靳元
 * @CreateDate: 2022/8/15 18:31
 * @UpdateRemark: 更新内容
 * @Version: 1.0
 */
public class PostRequest<T> extends Request<T,PostRequest>{
    public PostRequest(String url) {
        super(url);
    }

    @Override
    protected okhttp3.Request generateRequest(okhttp3.Request.Builder builder) {
        FormBody.Builder bodybuild = new FormBody.Builder();
        for (Map.Entry<String, Object> entry : params.entrySet()) {
            bodybuild.add(entry.getKey(), String.valueOf(entry.getValue()));
        }
        okhttp3.Request request = builder.url(mUrl).post(bodybuild.build()).build();
        return request;
    }
}
